home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
amiga
/
opalvisn
/
render.lha
/
Render.doc
< prev
next >
Wrap
Text File
|
1993-01-07
|
5KB
|
106 lines
Rendering to the OpalVision FrameBuffer.
This example code is provided to outline the main methods of
rendering to the OpalVision framebuffer from a typical 3D rendering
package. Renderer.c contains 4 functions:
Open_OpalScreen (ULONG Modes);
Render_To_Opal (int Y,Lines,Width, UBYTE *R,*G,*B,BOOL Chunky);
Opal_Render_Finished (void);
Close_Opal (void);
Open_OpalScreen() opens an OpalVision screen, this screen can be a
display screen (in chip memory) or a virtual screen (in fast memory),
see 'issues' below. Modes are the screenmodes defined in opallib.h,
and can be any combination of HIRES24,ILACE24 and OVERSCAN24.
Render_To_Opal() outputs image data to the frame buffer. The image
data must be in RGB Byte format. If 'Chunky' is FALSE, R,G and B
point to 3 individual buffers each containing Lines*Width bytes of
data. If 'Chunky' is TRUE, R,G,B point to the start of the Red, Green
and Blue data within one large interleaved buffer containing
3*Lines*Width bytes. The data must be interleaved with 1 scan line of
Red data, then Green data then blue data.
Opal_Render_Finished() should be called when the rendering is
finished, this function will make sure that the entire buffer has been
updated properly.
Close_Opal() should be called when you wish to cease display of the
24bit graphics. The display will be turned off and all memory freed.
The program RendTest.c is an example of using this code to display a
24bit image, this simply generates a gradient in 24bit.
ISSUES
1. ChipRam
If the Renderer is running on an Amiga with 1Meg of chip ram, there
will not be enough memory to display a hires-interlaced 24bit image.
In this case there are 2 options you can take. The first is to open a
display screen in chip ram anyway, a screen will be opened containing
the maximum number of lines possible given the amount of chip ram
available. This will of course cause a number of lines to be black at
the bottom of the screen, but will give the fastest update speed, if
you attempt to render past the bottom of the screen, the image data
will be clipped.
The second method is to open a full sized screen in fast ram, to
update the buffer, LowMemUpdate24() is used which can update the
entire image while only using a small amount of chip ram.
LowMemUpdate() however takes several frames for each update and blanks
the display while the update is occurring. This will slow down the
rendering and will cause the display to flash, but will give a full
screen view.
Renderer.c will check if there is enough chip memory before opening
the screen, if you define OPENVIRTUAL, it will use the second method
and open a screen in fast ram. If OPENVIRTUAL is not defined it will
open the largest screen possible in chip ram. The actual screen type
open is transparent to the program calling the functions in
Renderer.c.
The method that you use will depend on your application, and the
rendering speed required. The programs 'OneMeg' and 'TwoMeg' are
provided to alter the amount of chip ram in your machine so you can
experiment with the two different methods.
2. Horizontal Synchronisation.
Please Read the Section on Horizontal Synchronisation in the
Programmers reference manual, this is an important issue to know
about.
If you have an Intuition screen open, the best method to use is to set
the least significant bit of blue of your background colour on you
Intuition screen before calling Open_OpalScreen() then reset it again
after calling Close_Opal(). this can easily be achieved by using
LoadRGB4(). For example if the backgound colour is black (000), set
it to 001, or if its grey (888) set it to 889, only the background
colour needs to be changed. If this bit is already set (i.e. blue is
already odd), then you have no problems. If you are using this method,
DO NOT define AUTOSYNC in Renderer.c
If you cannot set the background colour for some reason, define
AUTOSYNC in renderer.c, this will set the Opalvision buffer into
AutoSync mode and will update the framebuffer constantly to avoid
horizontal shifting.
Defining AUTOSYNC will degrade the Amiga's performance as there will
be CPU contention accessing Chip Ram while the frame buffer is being
updated, if AUTOSYNC is not defined, a 10 frame gap will be placed
between each frame buffer update to give the CPU some breathing space.
If you have any questions, please contact me through Centaur
Development (310) 542-2226, or the OpalVision BBS (310) 793-7142.
Martin Boyd, Opal Technology.